<template>
  <div>
    <Content style="width:90%">
      <Form :label-width="140">
        <FormItem label="选择广告位">
          <Select placeholder="请选择广告位" v-model="dataForm.adposConfigCode">
            <Option value="APP.HOME.HEAD">APP首页广告轮播</Option>
          </Select>
        </FormItem>
        <FormItem label="广告位名称" required>
          <Input v-model="dataForm.adposConfigName" placeholder="请输入广告位名称"></Input>
        </FormItem>
        <FormItem label="广告位高度" required>
          <Input v-model="dataForm.adposHeight" placeholder="请输入广告位高度"></Input>
        </FormItem>
        <FormItem label="应用类型" required>
          <Select v-model="dataForm.appType">
            <Option :value="0" key="0">APP</Option>
            <Option :value="1" key="1">POS</Option>
            <Option :value="2" key="2">PC</Option>
          </Select>
        </FormItem>
        <FormItem>
          <Button type="primary" @click="Submit">提交</Button>
        </FormItem>
      </Form>
    </Content>
  </div>
</template>
<script>
export default {
  name: "Update",
  props: {
    callbank: Function
  },
  data() {
    return {
      dataForm: {
        adposWidth: '100%',
        adposHeight: '300px',
        appType: 0,
        sortIndex: 1
      }
    }
  },
  methods: {
    Submit() {
      new this.$rest({
        gateway: 'agroerp',
        service: "agroerp-mall",
        url: "/v1.0/adpos/config",
        data: {
          pojo: this.dataForm
        },
        action: (res) => {
          if (res.data.code === 20000) {
            this.$Message.success({
              content: '添加成功',
            })
            this.callbank()
          } else {
            this.$Message.error({
              content: res.data.msg
            })
          }
        },
      }).post()
    }
  }
}
</script>
<style scoped>
</style>